package com.bw.live_streaming.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bw.live_streaming.feign.MedicalFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bw.common.utils.PageUtils;
import com.bw.common.utils.Query;

import com.bw.live_streaming.dao.ClinicalDao;
import com.bw.live_streaming.entity.ClinicalEntity;
import com.bw.live_streaming.service.ClinicalService;


@Service("clinicalService")
public class ClinicalServiceImpl extends ServiceImpl<ClinicalDao, ClinicalEntity> implements ClinicalService {
    @Autowired
    private ClinicalDao clinicalDao;
    @Autowired
    private MedicalFeign medicalFeign;
    @Override
    public IPage<ClinicalEntity> getList(Map<String, Object> params) {

        Page<ClinicalEntity> page = new Page<>(Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("limit").toString()));
        System.out.println(params.get("patienName"));

        String patienName=null;
        if (!params.get("patienName").toString().equals("")){
            patienName=params.get("patienName").toString();
        }
        Integer userId=null;
        if (!params.get("userId").toString().equals("")){
            userId=Integer.valueOf(params.get("userId").toString());
        }
        Integer docterId = medicalFeign.doctorname(userId);
        Integer clinicalStatus=null;
        if (!params.get("clinicalStatus").toString().equals("")){
            clinicalStatus=Integer.valueOf(params.get("clinicalStatus").toString());
        }
        return clinicalDao.getList(page,patienName,docterId,clinicalStatus);

    }

}